package cn.lynu.study.practice11_15;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;

public class RandomAccessFile1 {
	public static void main(String[] args) {
		File file = new File("d:\\a.txt");
		try {
			RandomAccessFile raf = new RandomAccessFile(file, "rw");
			raf.seek(0);
			long a = raf.length();
			long i = a - 1;
			char c;
			String s = "";
			while (i >= 0) {
				raf.seek(i);
				c = (char) raf.read();
				s += c;
				i--;
			}
			raf.close();
			System.out.println(s);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}